//
// Created by hsj on 2022/1/14.
//

#include <iostream>
#include "t_class_memery.h"

namespace my_class_memery{
    //class内存占用
    void test_class_memery(){
        {
            StringBad headline1("hsj is smart!001");
            StringBad headline2 = StringBad("hsx is smart!002");
            StringBad sports("we are all like sports!");

            StringBad newer = sports;//复制构造函数
            StringBad newer002;//赋值运算符‘=’重载
            StringBad newer003;//赋值运算符‘=’重载
            newer002 = newer;
            newer003 = "HSJ is smart!";
            cout<<"headline1 : " <<headline1<<endl;
            cout<<"headline2 : " <<headline2<<endl;
            cout<<"sports : " <<sports<<endl;
            cout<<"newer : " <<newer<<endl;
            cout<<"newer002 : " <<newer002<<endl;
            cout<<"newer003 : " <<newer003<<endl;
            int hm = StringBad::howMany();
            cout<<"num_strings:"<<hm<<endl;


            //一些新增功能
            cout<<(headline1 < headline2)<<endl;//1 == true
            cout<<(headline1 > headline2)<<endl;//0 == false
            cout<<(newer == newer002)<<endl;//1 == true
        }
    }
}